
var getWords = function(arrays,strings){

  var chars = strings.split('')
  console.log(chars)

  let res =0

  for(var i=0;i<arrays.length;i++){

    var words = arrays[i];
    console.log(words)
    let inChars = JSON.parse(JSON.stringify(chars))
    for(let item of words){
      if(inChars.indexOf(item)>-1){

        inChars.splice(inChars.indexOf(item),1)

      }else if(inChars.indexOf('?')>-1){

        inChars.splice(inChars.indexOf('?'),1)
      }else{
        res = res+1
        break;
      }
    }
  }

  console.log(res)

  return arrays.length - res


}

var words = ['apple','car','window']

var chars = 'welldoneapplec?'

getWords(words,chars)